package com.Java7;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;

public class Newfeatures {

	static class FirstException extends Exception {
	}

	static class SecondException extends Exception {
	}

	// old
	public void rethrowException(String exceptionName) throws Exception {
		try {
			if (exceptionName.equals("First")) {
				throw new FirstException();
			} else {
				throw new SecondException();
			}
		} catch (Exception e) {
			throw e;
		}
	}

	// new
	public static void reThrowException(String exceptionName)
			throws FirstException, SecondException {
		try {
			if ("first".equals(exceptionName))
				throw new Exception();
			else
				throw new SecondException();
		} catch (Exception e) {
			try {
				throw e;
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		}
	}

	// new
	public static void first() {
		try {
			BufferedReader reader = new BufferedReader(new FileReader(""));
			Connection con = null;
			Statement stmt = con.createStatement();
		} catch (IOException | SQLException e) {
			// 捕获多个异常，e就是final类型的
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {

		int i = 124_123_123;
		System.out.println(i);

		Map<String, List<String>> anagrams1 = new HashMap<String, List<String>>();
		Map<String, List<String>> anagrams = new HashMap<>();
		
		ReentrantLock lock=new ReentrantLock();  

	}
}
//http://jinnianshilongnian.iteye.com/blog/1905964
